<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>前端模板页面</title>
    <script src="js/vue.global.3.5.13.js"></script>
    <script src="js/axios.min.0.24.0.js"></script>
    <script src="js/index.full.js"></script>
    <script src="js/icons-vue.js"></script>
    <script src="js/zh-cn.js"></script>
    <link rel="stylesheet" href="css/index.css">
</head>
<body>
<div id="app">
    <el-container>
        <el-header>
            <el-row>
                <el-col :span="12">
                    <h1>在线考试后台管理系统</h1>
                </el-col>
                <el-col :span="12" style="text-align: right">
                    欢迎您：<span style="color:red">{{user.userName}}</span>老师
                </el-col>
            </el-row>
            <hr>
        </el-header>
        <el-container>
            <el-aside style="margin: 40px 20px;width: 200px;height: 600px">
                <el-menu :default-openeds="['2']" @select="selectMenu">
                    <el-sub-menu index="1">
                        <template #title>
                            <el-icon><copy-document/></el-icon>
                            试卷管理
                        </template>
                        <el-menu-item index="exam_add.html">添加试卷</el-menu-item>
                        <el-menu-item index="exam_list.html">试卷维护</el-menu-item>
                    </el-sub-menu>
                    <el-sub-menu index="2">
                        <template #title>
                            <el-icon><copy-document/></el-icon>
                            题型管理
                        </template>
                        <el-menu-item index="type_add.html">添加题型</el-menu-item>
                        <el-menu-item index="type_list.html">题型维护</el-menu-item>
                    </el-sub-menu>
                    <el-sub-menu index="3">
                        <template #title>
                            <el-icon><copy-document/></el-icon>
                            试题管理
                        </template>
                        <el-menu-item index="question_input.html">录入试题</el-menu-item>
                        <el-menu-item index="question_list.html">试题维护</el-menu-item>
                    </el-sub-menu>

                    <el-menu-item index="score_list.html">
                        <template #title>
                            <el-icon><copy-document/></el-icon>
                            分数管理
                        </template>
                    </el-menu-item>

                    <el-menu-item index="updatePwd.html">
                        <template #title>
                            <el-icon><copy-document/></el-icon>
                            修改密码
                        </template>
                    </el-menu-item>
                    <el-menu-item index="logout">
                        <template #title>
                            <el-icon><copy-document/></el-icon>
                            退出系统
                        </template>
                    </el-menu-item>
                </el-menu>
            </el-aside>
            <el-main>
                <iframe :src="mainSrc" frameborder="0" style="width: 100%;height: 100%"></iframe>
            </el-main>
        </el-container>
        <el-footer style="text-align: center">
            <hr>
            版权所有：西安建筑科技大学华清学院
        </el-footer>
    </el-container>
</div>
<script>
    var option={
        data() {
            return {
                user:undefined,
                mainSrc:'welcome.html'
            }
        },
        methods:{
            selectMenu(index){
                if(index=='logout'){
                    this.$confirm("您确定要退出系统吗？").then(function(){
                        sessionStorage.removeItem("Teacher");
                        location.href="login.html";
                    });
                }else{
                    this.mainSrc=index;
                }
            }
        },
        created(){
            if (sessionStorage.getItem("Teacher")!=null){
                this.user=JSON.parse(sessionStorage.getItem("Teacher"));
            }else{
                alert("你还没有登录，无权进行访问");
                location.href="login.html";
            }
        }
    }
    var app=Vue.createApp(option);
    for(const[key,component] of Object.entries(ElementPlusIconsVue)){
        app.component(key,component);
    }
    app.use(ElementPlus,{locale:ElementPlusLocaleZhCn});
    app.mount("#app");
</script>
</body>
</html>